<?php
class retrieve_user_access extends retrieve_base{

	private $module_display_options 	= array();
	
	/**
	* function produces abstract structure of modules db structure
	*
    * used to generate the table structure required abstract function that passes an abstract
	* representation of the desired table structure to the proper database module which will
	* interpet the abstract and convert it into a valid SQL Create table structure.
	*
	* @return Array list of abstract table definitions for this module
	*/
	function create_table(){
		$tables = array();
		/**
		* Table structure for table 'documents'
		*/
	
		$fields = array(
			array("user_access_identifier"			,"unsigned integer"	,"NOT NULL"	,"auto_increment"	,"key"),
			array("user_access_client"				,"unsigned integer"	,"NOT NULL"	,"default '0'"),
			array("user_access_domain"				,"unsigned integer"	,"NOT NULL"	,"default '0'"		,"key"),
			array("user_access_browser"				,"varchar(255)"		,""			,"default ''"),
			array("user_access_platform"			,"varchar(50)"		,"NOT NULL"	,"default ''"),
			array("user_access_ip_address"			,"varchar(15)"		,""			,"default ''"		,"key"),
			array("user_access_reverse_dns_lookup"	,"varchar(255)"		,"NOT NULL"	,"default ''"),
			array("user_access_referer"				,"varchar(255)"		,"NOT NULL"	,"default ''"		,"key"),
			array("user_access_accept_language"		,"varchar(10)"		,""			,"default ''"),
			array("user_access_user_identifier"		,"integer"			,"NOT NULL"	,"default '-1'"		,"key"),
			array("user_access_session_identifier"	,"varchar(50)"		,"NOT NULL"	,"default '0'"),
			array("user_access_referal_qstring"		,"text"				,""			,"default ''"),
			array("user_access_bot_name"			,"varchar(50)"		,""			,"default ''")
			
		);
		$primary ="user_access_identifier";
		$tables[count($tables)] = array("user_access", $fields, $primary);

		$fields = array(
			array("access_log_owner"			,"unsigned integer"	,"NOT NULL"	,"default '0'","key"),
			array("access_log_client"			,"unsigned integer"	,"NOT NULL"	,"default '0'"),
			array("access_log_date"				,"datetime"			,"NOT NULL"	,"default '0000-00-00 00:00:00'"),
			array("access_log_url"				,"varchar(255)"		,"NOT NULL"	,""),
			array("access_log_query_string"		,"text"				,""			,""),
			array("access_log_type"				,"unsigned integer"	,"NOT NULL"	,"default '0'")
		);
		
		$primary ="";
		$tables[count($tables)] = array("user_access_log", $fields, $primary);

		$fields = array(
			array("access_ip"			,"varchar(15)"	,"NOT NULL"	,"default '0.0.0.0'"	,"key"),
			array("access_country"		,"varchar(2)"	,"NOT NULL"	,"default ''")
		);
		
		$primary ="";
		$tables[count($tables)] = array("user_access_ip_lookup", $fields, $primary);
		
		
		$fields = array(
			array("low_ip"			,"unsigned integer"	,"NOT NULL"	,"default ''"),
			array("high_ip"			,"unsigned integer"	,"NOT NULL"	,"default ''"),
			array("country_code"	,"varchar(2)"		,"NOT NULL"	,"default ''")
		);
		
		$primary ="";
		$tables[count($tables)] = array("user_access_ip_2_country", $fields, $primary);
		
		
		$fields = array(
			array("tld"				,"varchar(5)"		,"NOT NULL"	,"default ''"	,"key"),
			array("country"			,"varchar(255)"		,"NOT NULL"	,"default ''"),
			array("fips104"			,"varchar(5)"		,"NOT NULL"	,"default ''"),
			array("iso2"			,"varchar(5)"		,"NOT NULL"	,"default ''"),
			array("iso3"			,"varchar(5)"		,"NOT NULL"	,"default ''"),
			array("isono"			,"unsigned integer"	,"NOT NULL"	,"default ''"),
			array("capital"			,"varchar(255)"		,"NOT NULL"	,"default ''"),
			array("region"			,"varchar(255)"		,"NOT NULL"	,"default ''"),
			array("currency"		,"varchar(255)"		,"NOT NULL"	,"default ''"),
			array("currencycode"	,"varchar(5)"		,"NOT NULL"	,"default ''")
		);
		
		$primary ="tld";
		$tables[count($tables)] = array("user_access_countries", $fields, $primary);

		
		$fields = array(
			array("referal_identifier"	,"unsigned integer"	,"NOT NULL"	,"auto_increment"	,"key"),
			array("referal_url"			,"varchar(255)"		,"NOT NULL"	,"default ''")
		);
		
		$primary ="referal_identifier";
		$tables[count($tables)] = array("user_access_referals", $fields, $primary);
		
		return $tables;
	}
	/**
	* call the initialisation function only when this module is created
	*/
	function create_client_details($parameters){
	}
		

}
?>